import React from 'react'
import {connect} from '../store'

class ShoppingCar extends React.Component{
    constructor(props){
        super(props)
    }
   render(){
       let items=this.props.shop.shoppingcar.items
       let change=this.props.shop.change
       return <div>
         {items.map((item)=>{
             return <div>名称：{item.name},价格：{item.price},数量：{item.count}
             <button onClick={e=>change(item,+1)}>增加</button> 
             <button onClick={e=>change(item,-1)}>减少</button>
             </div>
         })}
       </div>
   }
}

export default connect(ShoppingCar)